import * as Cesium from 'cesium/Cesium'
import Measurement from "./Measurement";
import AreaMeasurementDrawing from "./AreaMeasurementDrawing";

function getIcon(e) {
    return '<svg viewBox="0 0 30 30" height="' + e + 'px" width="' + e + 'px">\n                 <g transform="translate(0,-267)">\n                   <circle r="2.0788691" cy="293.99896" cx="3.8532958"/>\n                   <circle r="2.0788691" cy="282.76791" cx="26.927404"/>\n                   <circle r="2.0788691" cy="270.20621" cx="4.0090437"/>\n                   <path d="m 26.326048,283.77014 -9.394396,5.02295 -9.3943948,5.02295 0.3471933,-10.64726 0.3471933,-10.64726 9.0472022,5.62431 z" transform="matrix(1.1625734,0,0,0.99297729,-4.6787891,1.2180486)"/>\n                 </g>\n               </svg>'
}
function AreaMeasurement(e) {
    e = Cesium.defaultValue(e, Cesium.defaultValue.EMPTY_OBJECT),
        Measurement.call(this, e), this._drawing = new AreaMeasurementDrawing(e)
}
AreaMeasurement.prototype = Object.create(Measurement.prototype),
    AreaMeasurement.prototype.constructor = AreaMeasurement,
    Cesium.defineProperties(AreaMeasurement.prototype, {
        area: {
            get: function () {
                return this._drawing.area
            }
        },
        icon: {value: getIcon(15)},
        thumbnail: {value: getIcon(25)},
        type: {value: "面积"},
        instructions: {value: ["单击以开始绘制多边形","继续单击以添加更多点","双击以完成绘制"]},
        id: {value: "areaMeasurement"}
    }), AreaMeasurement.prototype.handleDoubleClick = function () {
    this._drawing.handleDoubleClick()
}, AreaMeasurement.prototype.handleClick = function (e) {
    this._drawing.handleClick(e)
}, AreaMeasurement.prototype.handleMouseMove = function (e) {
    this._drawing.handleMouseMove(e)
}, AreaMeasurement.prototype.reset = function () {
    this._drawing.reset()
}, AreaMeasurement.prototype.isDestroyed = function () {
    return !1
}, AreaMeasurement.prototype.destroy = function () {
    return this._drawing.destroy(),Cesium. destroyObject(this)
};
export default AreaMeasurement;